#include "detector/e2e_net.h"

namespace autodrive {
namespace perception {
E2ENet::E2ENet() {};

E2ENet::~E2ENet() {};

/// @brief
/// @param settings
void E2ENet::Init(E2ENetSettings const& settings) noexcept(false) {
  settings_ = settings;
  auto initFunc{[this, &settings]() {
    auto const trtSettings{settings.trt_infer_settings};
    infer_engine_.Build(trtSettings);
  }};

  std::call_once(init_flag_, initFunc);
  is_init_ = true;
}

/// @brief
/// @param calibDataSetPtr
/// @param result
void E2ENet::Run(PerceptionResult& result) noexcept(false) {
  infer_engine_.DoInfer();
}

void E2ENet::Close() noexcept { infer_engine_.Release(); }
}  // namespace perception
}  // namespace autodrive